package com.video.zlc.audioplayer.ui;

import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.video.zlc.audioplayer.R;


/**
 * Created by zlc on 2017/9/15.
 */

public class VoiceActivity extends BaseActivity {

    private TextView id_tv_single;
    private TextView id_tv_list;
    private String from;
    private ImageView id_iv_fanhui;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        initView();
        initListener();
    }

    @Override
    public int getLayoutId() {
        return R.layout.activity_voice;
    }

    @Override
    protected void initView() {
        super.initView();
        id_tv_single = findView(R.id.id_tv_single);
        id_tv_list = findView(R.id.id_tv_list);
        id_iv_fanhui = findView(R.id.id_iv_fanhui);
        TextView id_tv_title = findView(R.id.id_tv_title);
        id_tv_title.setText("选择");
        from = getIntent().getStringExtra("from");
        Log.e(TAG+" from",from);
        if("record".equals(from)){
            id_tv_single.setText("开始录制");
            id_tv_list.setVisibility(View.GONE);
        }
    }

    @Override
    protected void initListener() {
        super.initListener();
        id_tv_single.setOnClickListener(this);
        id_tv_list.setOnClickListener(this);
        id_iv_fanhui.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        super.onClick(view);
        switch (view.getId()){
            case R.id.id_tv_single:
                if("listen".equals(from)) {
                    startActivity(ListenActivity.class);
                }else{
                    startActivity(RecordVoiceActivity.class);
                }
                break;
            case R.id.id_tv_list:
                if("listen".equals(from)) {
                    startActivity(ListenListActivity.class);
                }else {

                }
                break;
            case R.id.id_iv_fanhui:
                finish();
                break;
        }
    }
}
